{% extends "devhub/addons/submit/base.html" %}

{% block title %}{{ dev_page_title(_('Source Code Upload'), addon) }}{% endblock %}

{% block primary %}

{% set channel_param = 'listed' if version.channel == amo.CHANNEL_LISTED else 'unlisted' %}

<form method="post" enctype="multipart/form-data" id="submit-source">
    {% csrf_token %}
    <h3>{{ _('Do You Need to Submit Source Code?') }}</h3>
    <div>
        {{ source_form.non_field_errors() }}
        <p class="instruction-emphasis">
        {% trans %}
            Mozilla’s add-on reviewers need to be able to read and reproduce the code in your extension. If they can’t, your extension may be rejected.
        {% endtrans %}
        </p>
        <p class="list-header">
            <span class="instruction-emphasis">
            {% trans %}
                Do you use any of the following in your extension?
            {% endtrans %}
            </span>
        </p>
        <ul>
            <li>{% trans %}Code generators or minifiers{% endtrans %}</li>
            <li>
            {% trans %}Tools that combine multiple files into a single file, such as <span class="tech-emphasis">webpack</span>{% endtrans %}
            </li>
            <li>{% trans %}Web template engines, both for HTML and CSS{% endtrans %}</li>
            <li>{% trans %}Any other tool that takes code or files, applies processing, and generates code or file(s) to include in the extension{% endtrans %}</li>
        </ul>
        <p id="id_has_source">
            {% for radio in source_form.has_source %}
                {{ radio }}
            {% endfor %}
            {{ source_form.has_source.errors }}
        </p>
    </div>
    <div id="option_no_source">
        <p>
        {% trans %}
            You do not need to submit Source Code, and you’re ready for the next step.
        {% endtrans %}
        </p>
    </div>
    <div id="option_yes_source">
        <h3>{{ _("You must submit your extension's source code.") }}</h3>
        <p class="instruction-emphasis list-header">
        {% trans %}
            Your source code must include:
        {% endtrans %}
        </p>
        <ul>
            <li>{% trans %}Step-by-step build instructions to create an exact copy of the add-on code, in a README file in your source code or in the reviewer notes on the next page.{% endtrans %}</li>
            <li>{% trans %}A build script that executes all necessary technical steps.{% endtrans %}</li>
            <li>{% trans %}Operating system and build environment requirements.{% endtrans %}</li>
            <li>{% trans %}The required version and installation instructions of any programs used in the build process (such as <span class="tech-emphasis">node</span> and <span class="tech-emphasis">npm</span>).{% endtrans %}</li>
        </ul>
        <p>
            {% trans %}
                Source files (aside from open-source third party libraries) cannot be transpiled, concatenated, minified, or otherwise machine-generated.
            {% endtrans %}
        </p>
        <p>
            {% trans max_size=max_upload_size|filesizeformat %}
            The maximum file size accepted is {{ max_size }}.
            {% endtrans %}
        </p>
        <p>
            {% trans a_attrs='href="%s/documentation/publish/source-code-submission/?utm_source=addons.mozilla.org&utm_medium=devhub&utm_content=submission-flow" target="_blank" rel="noopener noreferrer"'|format(settings.EXTENSION_WORKSHOP_URL)|safe %}
                For more information, please read <a {{a_attrs}}>Source Code Submission</a> on Firefox Extension Workshop.
            {% endtrans %}
        </p>
        <p>
            <label for="{{ source_form.source.auto_id }}">{{ _("Upload source code:") }}</label>
            {{ source_form.source.errors }}
            {{ source_form.source }}
        </p>
    </div>

    <div class="submission-buttons addon-submission-field">
      <button type="submit">
        {{ _('Continue') }}
      </button>
      &nbsp;
      <button class="button delete-button confirm-submission-cancel"
              formnovalidate
              type="button"
              formaction="{{ url('devhub.addons.cancel', addon.slug, channel_param) }}">
          {{ _('Cancel and Disable Version') }}
      </button>
    </div>
  </form>

{% endblock primary %}
